export const isImageUrlOrBase64 = (str) => {
  // URL检测
  const urlPattern =
    /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/;
  if (urlPattern.test(str)) {
    return "url";
  }

  // base64编码检测
  const base64Pattern = /^data:image\/(png|jpg|jpeg|gif);base64,/;
  if (base64Pattern.test(str)) {
    return "base64";
  }

  // 不是URL也不是base64编码的图片
  return false;
};
